// 用户数据模块
import api from '@/common/request/index'
import store from '@/common/store'
import router from '@/common/router.js'
import tools from '@/common/utils/tools'

const state = {
	teaHillData: [],
	dayGameStatus: 0,
	posterStatus: 1 //用来记录海报生成状态 未生成完毕无法退出

}

const actions = {
	GET_TEA_HILL({
		state
	}, data) {
		api('introduce').then(res => {
			state.teaHillData = res.data
		}).catch(e => {
			console.log(e)
		})
	},
	//获取参赛状态
	getDayGameStatus({
		state
	}) {
		return new Promise((resolve, reject) => {
			api('dayGame.gameIndex').then(res => {
				state.dayGameStatus = res.data.game.join
				resolve(res.data)
			}).catch(err => {
				reject(0)
			})
		})

	},
}

const mutations = {
	updateOnPosterStatus(state, data) {
		state.posterStatus = data
	}
}

const getters = {

}

export default {
	state,
	mutations,
	actions,
	getters
}
